Thanks for sharing your piece of code @Timo2303, unfortunately I get the same error. BUT, if you let write:
@State private var player: AVPlayer?
Here I don't get any issues 🤔
Plus, all the posts related to that problem are recents and targeting iOS 17